#ifndef _HDL_PWM_H_
#define _HDL_PWM_H_

#include "bsp.h"

#define TIM_PWM_ENABLE      ON//OFF

#define PWM_TIM_TIMx                    TIM1
#define PWM_TIM_APBxClock_FUN           RCC_APB2PeriphClockCmd
#define PWM_TIM_CLK                     RCC_APB2Periph_TIM1
#define PWM_TIM_IRQ                     TIM1_UP_IRQn
#define PWM_TIM_IRQHandler              TIM1_UP_IRQHandler
#if (TIM_PWM_ENABLE == ON)
#define PWM_GPIO_APBxClock_FUN          RCC_APB2PeriphClockCmd
#define PWM_GPIO_GPIO_PeriphClock       RCC_APB2Periph_GPIOA
#define PWM_GPIO_GPIO_PORT              GPIOA
#define PWM_GPIO_GPIO_PIN               GPIO_Pin_8
#endif

#define PWM_TIM2_TIMx                    TIM2
#define PWM_TIM2_APBxClock_FUN           RCC_APB1PeriphClockCmd
#define PWM_TIM2_CLK                     RCC_APB1Periph_TIM2
#define PWM_TIM2_IRQ                     TIM2_IRQn
#define PWM_TIM2_IRQHandler              TIM2_IRQHandler
#if (TIM_PWM_ENABLE == ON)
#define PWM_CH2_GPIO_APBxClock_FUN       RCC_APB2PeriphClockCmd
#define PWM_CH2_GPIO_PeriphClock         RCC_APB2Periph_GPIOA
#define PWM_CH2_GPIO_PORT                GPIOA
#define PWM_CH2_GPIO_PIN                 GPIO_Pin_1
#endif


extern struct hal_pwm_if g_hdl_pwm_if;

int8_t hdl_pwm_init(uint16_t per_ms);
void hdl_servo_angle_ctrl(uint16_t Angle);
void servo_scan(void);

int8_t hdl_pwm_ch2_init(uint16_t per_ms);
#endif
